package LuMin.file.Read;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;

/**
 * @author lumin
 * @date 2022/05/09 19:09
 **/
public class ReadFile2 {
    public static void main(String[] args) throws IOException {
        try(InputStream is = new FileInputStream("hello.txt")) {
            byte[] buf = new byte[5];
            while (true){
                int n = is.read(buf);
                if(n == -1){
                 break;
                }
                System.out.println(Arrays.toString(Arrays.copyOf(buf,n)));
            }
        }
    }
}